<?php
/**
 * User: zhangligang
 * Email: tzhang2450@163.com
 * Date: 2018/11/20
 * Time: 03:21
 */

namespace App\Http\Controllers;

use App\Http\Services\WorkService;
use Laravel\Lumen\Routing\Controller;

class ManagerController extends Controller
{

    public function index($include = 'manager/work')
    {
        return view('manager.index', ['include' => $include]);
    }

    public function work()
    {
        return view('manager.work');
    }

    public function category()
    {
        return view('manager.category');
    }

    public function createCategory()
    {
        return view('manager.category-create');
    }

    public function editCategory($id)
    {
        return view('manager.category-edit', ['id' => $id]);
    }

    public function detail($id)
    {
        return view('manager.detail', ['id' => $id]);
    }

    public function workMark()
    {
        return view('manager.work-mark');
    }

    public function user()
    {
        return view('manager.user');
    }

    public function createUser()
    {
        return view('manager.user-create');
    }

    public function editUser($id)
    {
        return view('manager.user-edit', ['id' => $id]);
    }

    public function file()
    {
        return view('manager.file');
    }

    public function editFile()
    {
        return view('manager.file-edit');
    }

    public function set()
    {
        return view('manager.set');
    }

    public function export()
    {
        $phpExcel = new \PHPExcel();
        $dataHead = [
            '序号', '参赛选手', '作品名称', '专家打分', '平均分'
        ];
        $data = WorkService::getAllWorkMark();

        \Export::exportToExcel($phpExcel, '导出邀请码', $dataHead, $data);exit;
    }
}